package com.dao;

import com.pojo.Dormitory;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DormitoryDao {
    /**
     * -- 查询所有宿舍以及对应楼
     */
    public List<Dormitory> FindAllDormitory();


    /**
     * 添加宿舍
     *
     * @param id
     * @param bid
     * @return
     */
    Integer addDormitory(@Param("id") String id,@Param("bid") String bid);

    /**
     * 修改宿舍
     * @param id
     * @param bid
     * @return
     */
    Integer updateDormitory(@Param("id")String id, @Param("bid") String bid);


    @Delete("delete from dormitory where id = #{id}")
    Integer deleteById(String id);


    @Select("select buildingId from dormitory where id = #{dormitoryname}")
    String selectBuildByName(@Param("dormitoryname") String dormitoryname);

}
